package com.personal.system.listener.mq;

import com.personal.system.constant.redis.RedisService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Slf4j
@Service
public class MqSender {

    @Resource
    private AmqpTemplate amqpTemplate;

    public void sendSeckillMsg(SeckillMessage message) {
        String msg = RedisService.beanToString(message);
        log.info("发送的消息：{}",msg);
        amqpTemplate.convertAndSend("seckill.queue", msg);
    }

}
